﻿using System.Linq;
using WimClipboard.Properties;

namespace WimClipboard
{
    public class UiSettings
    {
        private static UiSettings instance;

        private UiSettings()
        {
        }

        public static UiSettings Instance
        {
            get
            {
                return instance ?? (instance = new UiSettings());
            }
        }

        public double MainWindowTop
        {
            get
            {
                return Settings.Default.MainWindowTop;
            }

            set
            {
                if (App.Current.MainWindow.IsLoaded)
                {
                    Settings.Default.MainWindowTop = value;
                    Settings.Default.Save();
                }
            }
        }

        public double MainWindowLeft
        {
            get
            {
                return Settings.Default.MainWindowLeft;
            }

            set
            {
                if (App.Current.MainWindow.IsLoaded)
                {
                    Settings.Default.MainWindowLeft = value;
                    Settings.Default.Save();
                }
            }
        }

        public double MainWindowWidth
        {
            get
            {
                return Settings.Default.MainWindowWidth;
            }

            set
            {
                if (App.Current.MainWindow.IsLoaded)
                {
                    Settings.Default.MainWindowWidth = value;
                    Settings.Default.Save();
                }
            }
        }

        public double MainWindowHeight
        {
            get
            {
                return Settings.Default.MainWindowHeight;
            }

            set
            {
                if (App.Current.MainWindow.IsLoaded)
                {
                    Settings.Default.MainWindowHeight = value;
                    Settings.Default.Save();
                }
            }
        }
    }
}